package com.xinnet.mms.allot;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

import com.xinnet.mms.entity.Customer;
/**
 * 
 * 
 * @author 王湛智[wangzhanzhi@xinnet.com]
 *
 * @version 1.0
 *
 * @since 2014年3月3日
 *
 */
public class AutoCustomer {
	private static SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	private static String[] surname={
			"赵","钱","孙","李","周","吴","郑","王",
			"冯","陈","楮","卫","蒋","沈","韩","杨",
			"朱","秦","尤","许","何","吕","施","张",
			"孔","曹","严","华","金","魏","陶","姜",
			"戚","谢","邹","喻","柏","水","窦","章",
			"云","苏","潘","葛","奚","范","彭","郎",
			"鲁","韦","昌","马","苗","凤","花","方",
			"俞","任","袁","柳","酆","鲍","史","唐",
			"费","廉","岑","薛","雷","贺","倪","汤",
			"滕","殷","罗","毕","郝","邬","安","常",
			"乐","于","时","傅","皮","卞","齐","康",
			"伍","余","元","卜","顾","孟","平","黄",
			"和","穆","萧","尹","姚","邵","湛","汪",
			"祁","毛","禹","狄","米","贝","明","臧",
			"计","伏","成","戴","谈","宋","茅","庞",
			"熊","纪","舒","屈","项","祝","董","梁",
			"杜","阮","蓝","闽","席","季","麻","强",
			"贾","路","娄","危","江","童","颜","郭",
			"梅","盛","林","刁","锺","徐","丘","骆",
			"高","夏","蔡","田","樊","胡","凌","霍",
			"虞","万","支","柯","昝","管","卢","莫",
			"经","房","裘","缪","干","解","应","宗",
			"丁","宣","贲","邓","郁","单","杭","洪",
			"包","诸","左","石","崔","吉","钮","龚",
			"程","嵇","邢","滑","裴","陆","荣","翁",
			"荀","羊","於","惠","甄","麹","家","封",
			"芮","羿","储","靳","汲","邴","糜","松",
			"井","段","富","巫","乌","焦","巴","弓",
			"牧","隗","山","谷","车","侯","宓","蓬",
			"全","郗","班","仰","秋","仲","伊","宫",
			"宁","仇","栾","暴","甘","斜","厉","戎",
			"祖","武","符","刘","景","詹","束","龙",
			"叶","幸","司","韶","郜","黎","蓟","薄",
			"印","宿","白","怀","蒲","邰","从","鄂",
			"索","咸","籍","赖","卓","蔺","屠","蒙",
			"池","乔","阴","郁","胥","能","苍","双",
			"闻","莘","党","翟","谭","贡","劳","逄",
			"姬","申","扶","堵","冉","宰","郦","雍",
			"郤","璩","桑","桂","濮","牛","寿","通",
			"边","扈","燕","冀","郏","浦","尚","农",
			"温","别","庄","晏","柴","瞿","阎","充",
			"慕","连","茹","习","宦","艾","鱼","容",
			"向","古","易","慎","戈","廖","庾","终",
			"暨","居","衡","步","都","耿","满","弘",
			"匡","国","文","寇","广","禄","阙","东",
			"欧","殳","沃","利","蔚","越","夔","隆",
			"师","巩","厍","聂","晁","勾","敖","融",
			"冷","訾","辛","阚","那","简","饶","空",
			"曾","毋","沙","乜","养","鞠","须","丰",
			"巢","关","蒯","相","查","后","荆","红",
			"游","竺","权","逑","盖","益","桓","公",
			"万俟","司马","上官","欧阳",
			"夏侯","诸葛","闻人","东方",
			"赫连","皇甫","尉迟","公羊",
			"澹台","公冶","宗政","濮阳",
			"淳于","单于","太叔","申屠",
			"公孙","仲孙","轩辕","令狐",
			"锺离","宇文","长孙","慕容",
			"鲜于","闾丘","司徒","司空",
			"丌官","司寇","仉","督","子车",
			"颛孙","端木","巫马","公西",
			"漆雕","乐正","壤驷","公良",
			"拓拔","夹谷","宰父","谷梁",
			"晋","楚","阎","法","汝","鄢","涂","钦",
			"段干","百里","东郭","南门",
			"呼延","归","海","羊舌","微生",
			"岳","帅","缑","亢","况","后","有","琴",
			"梁丘","左丘","东门","西门",
			"商","牟","佘","佴","伯","赏","南宫",
			"墨","哈","谯","笪","年","爱","阳","佟"
	};
	private static String name="国哎咕昌呵畅明易咙昂迪典固忠呻咒咋咐呼鸣咏呢咄咖岸岩帖罗帜帕岭凯败账贩贬购贮图钓制知迭氛垂牧物乖刮秆和季委秉佳侍岳供使例侠侥版侄侦侣侧凭侨佩货侈依卑的迫质欣征往爬彼径所舍金刹命肴斧爸采觅受乳贪念贫忿肤肺肢肿胀朋股肮肪肥服胁周昏鱼兔狐忽狗狞备饰饱饲变京享庞店夜庙府底疟疙疚剂卒郊庚废净盲放刻育氓闸闹郑券卷单炬炒炊炕炎炉沫浅法泄沽河沾泪沮油泊沿泡注泣泞泻泌泳泥沸沼波泼泽治怔怯怖性怕怜怪怡学宝宗定宠宜审宙官空帘宛实试郎诗肩房诚衬衫视祈话诞诡询该详建肃录隶帚屉居届刷屈弧弥弦承孟陋陌孤陕降函限妹姑姐姓妮始姆迢驾叁参艰线练组绅细驶织驹终驻绊驼绍绎经贯契贰奏春帮玷珍玲珊玻毒型拭挂封持拷拱项垮挎城挟挠政赴赵挡拽哉挺括垢拴拾挑垛指垫挣挤拼挖按挥挪拯某甚荆茸革茬荐巷带草茧茵茶荒茫荡荣荤荧故胡荫荔南药标栈柑枯柄栋相查柏栅柳柱柿栏柠树勃要柬咸威歪研砖厘厚砌砂泵砚砍面耐耍牵鸥残殃轴轻鸦皆韭背战点虐临览竖省削尝昧盹是盼眨哇哄哑显冒映星昨咧昭畏趴胃贵界虹虾蚁思蚂虽品咽骂勋哗咱响哈哆咬咳咪哪哟炭峡罚贱贴贻骨幽钙钝钞钟钢钠浠浣浚悚悭悝悒悌悛宸窈剜诹冢诼袒袢祯诿谀谂谄谇屐屙陬勐奘牂蚩陲姬娠娌娉娲娩娴娣娓婀畚逡绠骊绡骋绥绦绨骎邕鸶彗耜焘舂琏琇麸揶埴埯捯掳掴埸埵赧埤捭逵埝堋堍掬鸷掖捽掊堉掸捩掮悫埭埽掇掼聃菁萁菘堇萘萋菽菖萜萸萑棻菔菟萏萃菏菹菪菅菀萦菰菡梵梿梏觋桴桷梓棁桫棂啬郾匮敕豉鄄酞酚戛硎硭硒硖硗硐硇硌鸸瓠匏厩龚殒殓殍赉雩辄堑眭眦啧晡晤眺眵眸圊喏喵啉勖晞唵晗冕啭畦趺啮跄蚶蛄蛎蛆蚰蛊圉蚱蛉蛏蚴啁啕唿啐唼唷啖啵啶啷唳唰啜帻崚崦帼崮崤崆赇赈赊铑铒铗铙铟铠铡铢铣铤铧铨铩铪铫铬铮铯铰铱铳铵铷氪牾鸹秾逶笺筇笸笪笮笠笥笤笳笾笞偾偃偕偈傀偬偻皑皎鸻徜舸舻舴舷龛翎脬脘脲匐猗猡猞猝斛猕馗馃馄鸾孰庹庾痔痍疵翊旌旎袤阇阈阉阊阋阍阏羟粝粕敝焐烯焓烽焖烷焗渍渚淇淅淞渎涿淖挲淠涸渑淦淝淬涪淙涫渌淄惬悻悱惝惘悸惆惚惇惮窕谌谏扈皲谑裆袷裉谒谔谕谖谗谙谛谝逯郿隈粜隍隗婧婊婕娼婢婵胬袈翌恿欸绫骐绮绯绱骒绲骓绶绺绻绾骖缁耠琫琵琶琪瑛琦琥琨靓琰琮琯琬琛琚辇鼋揳堞搽揸揠堙趄揖颉塄揿耋揄蛩蛰塆摒揆掾聒葑葚靰靸葳葺葸萼葆葩葶蒌萱戟葭楮棼椟棹椤棰赍椋椁椪棣椐";
	
	/**自动封装新客户*/
	public static Customer makeNewCustomer(String areaId,String areaName,String productId,String productName,Integer customerType) {
		Customer customer=new Customer();
		customer.setAddTime(sf.format(new Date()));
		customer.setCname(autoName());
		customer.setProductLabel(productId);//1域名2虚机3邮局
		customer.setAreaName(areaName);
		customer.setRegionalId(areaId);
		customer.setReportedEmpId("");
		customer.setProductName(productName);
		customer.setPusherDeptId("");
		customer.setCusId(UUID.randomUUID().toString());
		customer.setEmail(UUID.randomUUID().toString().substring(0,10)+"@"+"163.com");
		customer.setPusherId("system");
		customer.setPhone(UUID.randomUUID().toString().substring(0,10));
		customer.setIsAllot(0);
		customer.setIsReDevel(0);
		customer.setCustomerType(customerType);
		customer.setCustomerSource("网站");
		return customer;
	}
	
//	public static Customer makeServiceCustomer() {
//		return null;
//	}
	
	/**自动生成姓名*/
	private static String autoName() {
		int surNameIndex=(int)(Math.random()*surname.length+1);
		int nameIndex=(int)(Math.random()*name.length()+1);
		int nameIndex2=(int)(Math.random()*name.length()+1);
		if(nameIndex-1<0)nameIndex+=1;
		if(nameIndex2-1<0)nameIndex2+=1;
		if(nameIndex%2==0) {
			return surname[surNameIndex]+name.substring(nameIndex-1,nameIndex)+name.substring(nameIndex2-1,nameIndex2);
		}
		return surname[surNameIndex]+name.substring(nameIndex-1,nameIndex);
	}
}
